home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #3
/
Amiga Plus CD - 1997 - No. 03.iso
/
pd
/
programmierung
/
alienbreed3d2_src
/
cheesesauce
/
newanims
< prev
next >
Wrap
Text File
|
1997-01-31
|
59KB
|
4,252 lines
TypeOfSplat: dc.w 0
BRIGHTY: dc.l 0
BRIGHTENPOINTS:
; d0=brightness value
; d1=XPOS
; d2=ZPOS
; d3=ROOMNUMBER
tst.w d0
bgt DARKENPOINTS
movem.l d0-d7/a0-a6,-(a7)
move.l ZoneAdds,a0
move.l (a0,d3.w*4),a0
add.l LEVELDATA,a0
move.l #CurrentPointBrights,a2
move.l Points,a3
move.l ZoneBorderPts,a4
lea ToListOfGraph(a0),a1
BRIGHTPTS:
move.w (a1),d4
blt brightall
move.l ZoneAdds,a0
move.l (a0,d4.w*4),a0
add.l LEVELDATA,a0
add.w #8,a1
moveq #9,d7
muls #20,d4
lea (a4,d4.w),a5
move.l #CurrentPointBrights,a2
lea (a2,d4.w*4),a2
; Do a room.
ROOMPTLOP
move.w (a5)+,d4
blt BRIGHTPTS
move.w (a3,d4.w*4),d5
move.w 2(a3,d4.w*4),d6
sub.w d1,d5
bgt.s .okpos1
neg.w d5
.okpos1
sub.w d2,d6
bgt.s .okpos2
neg.w d6
.okpos2
add.w d6,d5
move.l BRIGHTY,d4
cmp.l ToZoneFloor(a0),d4
bgt .noBRIGHT1
cmp.l ToZoneRoof(a0),d4
blt .noBRIGHT1
move.w d5,d6
move.l ToZoneRoof(a0),d4
sub.l BRIGHTY,d4
bgt.s .noBRIGHT2
neg.l d4
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT2
tst.w 2(a2)
bge.s .okbr2
neg.w 2(a2)
.okbr2:
add.w 2(a2),d6
cmp.w #300,d6
bge.s .notoobr2
move.w #300,d6
.notoobr2:
move.w d6,2(a2)
.noBRIGHT2
move.w d5,d6
move.l ToZoneFloor(a0),d4
sub.l BRIGHTY,d4
blt.s .noBRIGHT1
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT1
tst.w (a2)
bge.s .okbr1
neg.w (a2)
.okbr1:
add.w (a2),d6
cmp.w #300,d6
bge.s .notoobr1
move.w #300,d6
.notoobr1:
move.w d6,(a2)
.noBRIGHT1
move.l BRIGHTY,d4
cmp.l ToUpperFloor(a0),d4
bgt .noBRIGHT4
cmp.l ToUpperRoof(a0),d4
blt .noBRIGHT4
move.w d5,d6
move.l ToUpperFloor(a0),d4
sub.l BRIGHTY,d4
blt.s .noBRIGHT3
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT3
tst.w 4(a2)
bge.s .okbr3
neg.w 4(a2)
.okbr3:
add.w 4(a2),d6
cmp.w #300,d6
bge.s .notoobr3
move.w #300,d6
.notoobr3:
move.w d6,4(a2)
.noBRIGHT3
move.w d5,d6
move.l ToUpperRoof(a0),d4
sub.l BRIGHTY,d4
bgt.s .noBRIGHT4
neg.l d4
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT4
tst.w 6(a2)
bge.s .okbr4
neg.w 6(a2)
.okbr4:
add.w 6(a2),d6
cmp.w #300,d6
bge.s .notoobr4
move.w #300,d6
.notoobr4:
move.w d6,6(a2)
.noBRIGHT4
addq #8,a2
dbra d7,ROOMPTLOP
bra BRIGHTPTS
brightall:
movem.l (a7)+,d0-d7/a0-a6
rts
BRIGHTENPOINTSANGLE:
; d0=brightness value
; d1=XPOS
; d2=ZPOS
; d3=ROOMNUMBER
; d4=ANGLE
movem.l d0-d7/a0-a6,-(a7)
move.l #SineTable,a0
lea (a0,d4.w),a6
move.l ZoneAdds,a0
move.l (a0,d3.w*4),a0
add.l LEVELDATA,a0
move.l #CurrentPointBrights,a2
move.l Points,a3
move.l ZoneBorderPts,a4
lea ToListOfGraph(a0),a1
BRIGHTPTSA:
move.w (a1),d4
blt brightallA
move.l ZoneAdds,a0
move.l (a0,d4.w*4),a0
add.l LEVELDATA,a0
add.w #8,a1
moveq #9,d3
muls #20,d4
lea (a4,d4.w),a5
move.l #CurrentPointBrights,a2
lea (a2,d4.w*4),a2
ROOMPTLOPA
move.w (a5)+,d4
blt BRIGHTPTSA
move.w 2(a3,d4.w*4),d5
move.w (a3,d4.w*4),d4
sub.w d1,d4
move.w d4,d6
bgt.s .okpos1
neg.w d4
.okpos1
sub.w d2,d5
move.w d5,d7
bgt.s .okpos2
neg.w d5
.okpos2
movem.l d0/d1/d2/d3/d4/d5,-(a7)
move.w (a6),d0
move.w 2048(a6),d1
muls d7,d1
muls d6,d0
add.l d0,d1
ble BEHINDPT
move.l d1,d5
neg.l d5
add.l #30*65536,d5
bge.s .okkkkk
moveq #0,d5
.okkkkk
move.w (a6),d0
move.w 2048(a6),d1
; ext.l d0
; ext.l d1
; asl.l #6,d1
; asl.l #6,d0
; swap d0
; swap d1
; neg.w d0
; neg.w d1
; add.w d6,d0
; add.w d7,d1
muls d0,d7
muls d1,d6
sub.l d6,d7
bgt.s .okkk
neg.l d7
.okkk
add.l d5,d7
asl.l #2,d7
swap d7
movem.l (a7)+,d0/d1/d2/d3/d4/d5
add.w d7,d5
add.w d4,d5
move.l BRIGHTY,d4
cmp.l ToZoneFloor(a0),d4
bgt .noBRIGHT1
cmp.l ToZoneRoof(a0),d4
blt .noBRIGHT1
move.w d5,d6
move.l ToZoneRoof(a0),d4
sub.l BRIGHTY,d4
bgt.s .noBRIGHT2
neg.l d4
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT2
tst.w 2(a2)
bge.s .okbr2
neg.w 2(a2)
.okbr2:
add.w 2(a2),d6
cmp.w #300,d6
bge.s .notoobr2
move.w #300,d6
.notoobr2:
move.w d6,2(a2)
.noBRIGHT2
move.w d5,d6
move.l ToZoneFloor(a0),d4
sub.l BRIGHTY,d4
blt.s .noBRIGHT1
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT1
tst.w (a2)
bge.s .okbr1
neg.w (a2)
.okbr1:
add.w (a2),d6
cmp.w #300,d6
bge.s .notoobr1
move.w #300,d6
.notoobr1:
move.w d6,(a2)
.noBRIGHT1
move.l BRIGHTY,d4
cmp.l ToUpperFloor(a0),d4
bgt .noBRIGHT4
cmp.l ToUpperRoof(a0),d4
blt .noBRIGHT4
move.w d5,d6
move.l ToUpperFloor(a0),d4
sub.l BRIGHTY,d4
blt.s .noBRIGHT3
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT3
tst.w 4(a2)
bge.s .okbr3
neg.w 4(a2)
.okbr3:
add.w 4(a2),d6
cmp.w #300,d6
bge.s .notoobr3
move.w #300,d6
.notoobr3:
move.w d6,4(a2)
.noBRIGHT3
move.w d5,d6
move.l ToUpperRoof(a0),d4
sub.l BRIGHTY,d4
bgt.s .noBRIGHT4
neg.l d4
asr.l #7,d4
add.w d4,d6
asr.w #5,d6
add.w d0,d6
bge.s .noBRIGHT4
tst.w 6(a2)
bge.s .okbr4
neg.w 6(a2)
.okbr4:
add.w 6(a2),d6
cmp.w #300,d6
bge.s .notoobr4
move.w #300,d6
.notoobr4:
move.w d6,6(a2)
.noBRIGHT4
addq #8,a2
dbra d3,ROOMPTLOPA
bra BRIGHTPTS
BEHINDPT:
movem.l (a7)+,d0/d1/d2/d3/d4/d5
addq #8,a2
dbra d7,ROOMPTLOPA
bra BRIGHTPTSA
brightallA:
movem.l (a7)+,d0-d7/a0-a6
rts
DARKENPOINTS
movem.l d0-d7/a0-a6,-(a7)
move.l ZoneAdds,a0
move.l (a0,d3.w*4),a0
add.l LEVELDATA,a0
move.l #CurrentPointBrights,a2
move.l Points,a3
move.l a0,a1
add.w ToZonePts(a0),a1
DARKPTS:
move.w (a1)+,d4
blt.s DARKall
move.w (a3,d4.w*4),d5
move.w 2(a3,d4.w*4),d6
sub.w d1,d5
bgt.s .okpos1
neg.w d5
.okpos1
sub.w d2,d6
bgt.s .okpos2
neg.w d6
.okpos2
add.w d5,d6
asr.w #5,d6
add.w d0,d6
ble.s DARKPTS
add.w d6,(a2,d4.w*4)
add.w d6,2(a2,d4.w*4)
bra.s DARKPTS
DARKall:
movem.l (a7)+,d0-d7/a0-a6
rts
Flash:
; D0=number of a zone, D1=brightness change
cmp.w #-20,d1
bgt.s .okflash
move.w #-20,d1
.okflash:
movem.l d0/a0/a1,-(a7)
move.l #CurrentPointBrights,a1
move.l ZoneAdds,a0
move.l (a0,d0.w*4),a0
add.l LEVELDATA,a0
move.l a0,-(a7)
add.w ToZonePts(a0),a0
flashpts:
move.w (a0)+,d2
blt.s flashedall
add.w d1,(a1,d2.w*4)
add.w d1,2(a1,d2.w*4)
bra flashpts
flashedall:
move.l (a7)+,a0
move.l #ZoneBrightTable,a1
add.w d1,(a1,d0.w*4)
add.w d1,2(a1,d0.w*4)
add.l #ToListOfGraph,a0
doemall:
move.w (a0),d0
blt.s doneemall
add.w d1,(a1,d0.w*4)
add.w d1,2(a1,d0.w*4)
addq #8,a0
bra.s doemall
doneemall:
movem.l (a7)+,d0/a0/a1
rts
prot2: dc.w 0
radius: dc.w 0
ExplodeIntoBits:
move.w d3,radius
cmp.w #7,d2
ble.s .oksplut
move.w #7,d2
.oksplut:
move.l NastyShotData,a5
move.w #19,d1
.findeight
move.w 12(a5),d0
blt.s .gotonehere
adda.w #64,a5
dbra d1,.findeight
rts
.gotonehere
move.b #0,shotpower(a5)
move.l ObjectPoints,a2
move.w (a5),d3
lea (a2,d3.w*8),a2
; jsr GetRand
; lsr.w #4,d0
; move.w radius,d1
; and.w d1,d0
; asr.w #1,d1
; sub.w d1,d0
move.w newx,d0
move.w d0,(a2)
; jsr GetRand
; lsr.w #4,d0
; move.w radius,d1
; and.w d1,d0
; asr.w #1,d1
; sub.w d1,d0
move.w newz,d0
move.w d0,4(a2)
move.b #2,16(a2)
jsr GetRand
and.w #8190,d0
move.l #SineTable,a2
adda.w d0,a2
move.w (a2),d3
move.w 2048(a2),d4
Jsr GetRand
and.w #3,d0
add.w #1,d0
ext.l d3
ext.l d4
asl.l d0,d3
asl.l d0,d4
move.l ImpactX(a0),d0
swap d4
asr.w #1,d0
add.w d0,d4
swap d0
move.w d4,shotzvel(a5)
swap d3
asr.w #1,d0
add.w d0,d3
move.w d3,shotxvel(a5)
jsr GetRand
and.w #1023,d0
add.w #2*128,d0
neg.w d0
move.w d0,shotyvel(a5)
move.l #0,EnemyFlags(a5)
move.w 12(a0),12(a5)
; jsr GetRand
; lsr.w #4,d0
; move.w radius,d1
; and.w d1,d0
; asr.w #1,d1
; sub.w d1,d0
move.w 4(a0),d0
move.w d0,4(a5)
add.w #6,d0
ext.l d0
asl.l #7,d0
move.l d0,accypos(a5)
; move.w d2,d0
; and.w #3,d0
; add.w #50,d0
move.b TypeOfSplat,shotsize(a5)
; move.w #40,shotgrav(a5)
move.w #0,shotflags(a5)
move.w #0,shotlife(a5)
clr.b shotstatus(a5)
move.b ObjInTop(a0),ObjInTop(a5)
st worry(a5)
adda.w #64,a5
sub.w #1,d2
blt.s .gotemall
dbra d1,.findeight
.gotemall
rts
brightanim:
move.l #BrightAnimTable,a1
move.l #BrightAnimPtrs,a3
move.l #BrightAnimStarts,a4
dobrightanims
move.l (a3),d0
blt nomoreanims
move.l d0,a2
move.w (a2)+,d0
cmp.w #999,d0
bne.s itsabright
move.l (a4),a2
move.w (a2)+,d0
itsabright:
move.l a2,(a3)+
addq #4,a4
move.w d0,(a1)+
bra.s dobrightanims
nomoreanims:
rts
BrightAnimTable: ds.w 20
BrightAnimPtrs:
dc.l PulseANIM1
dc.l PulseANIM2
dc.l PulseANIM3
dc.l PulseANIM4
dc.l PulseANIM5
dc.l FlickerANIM
dc.l FireFlickerANIM
dc.l -1
BrightAnimStarts:
dc.l PulseANIM1
dc.l PulseANIM2
dc.l PulseANIM3
dc.l PulseANIM4
dc.l PulseANIM5
dc.l FlickerANIM
dc.l FireFlickerANIM
PulseANIM1:
dc.w 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
dc.w 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
dc.w 999
PulseANIM2:
dc.w 9,10,11,12,13,14,15,16,17,18,19,20
dc.w 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
dc.w 1,2,3,4,5,6,7,8
dc.w 999
PulseANIM3:
dc.w 17,18,19,20
dc.w 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
dc.w 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
dc.w 999
PulseANIM4:
dc.w 16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
dc.w 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17
dc.w 999
PulseANIM5:
dc.w 8,7,6,5,4,3,2,1
dc.w 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9
dc.w 999
FlickerANIM:
dcb.w 20,20
dc.w 1
dcb.w 30,20
dc.w 1
dcb.w 5,20
dc.w 1
dc.w 999
FireFlickerANIM:
dc.w -10,-9,-6,-10,-6,-5,-5,-7,-5,-10,-9,-8,-7,-5,-5,-5,-5
dc.w -5,-5,-5,-5,-6,-7,-8,-9,-5,-10,-9,-10,-6,-5,-5,-5,-5,-5
dc.w -5,-5
dc.w 999
realtab:
dc.l prot1-78935450
dc.l prot2-78935450
dc.l prot3-78935450
dc.l prot4-78935450
dc.l prot5-78935450
dc.l prot6-78935450
dc.l prot7-78935450
dc.l prot8-78935450
dc.l prot9-78935450
dc.l protA-78935450
objvels: ds.l 8
FramesToDraw: dc.w 0
TempFrames: dc.w 0
objmoveanim:
move.l PLR1_Roompt,a0
move.w (a0),PLR1_Zone
move.l PLR2_Roompt,a0
move.w (a0),PLR2_Zone
move.w #0,PLAYERONENOISEVOL
move.w #0,PLAYERTWONOISEVOL
bsr Player1Shot
bsr Player2Shot
; bsr SwitchRoutine
bsr ObjectHandler
bsr DoorRoutine
move.w #0,PLR1_FloorSpd
move.w #0,PLR2_FloorSpd
bsr LiftRoutine
bsr brightanim
subq.w #1,animtimer
bgt.s notzero
move.w #2,animtimer
move.l otherrip,d0
move.l RipTear,otherrip
move.l d0,RipTear
notzero:
rts
******************************
tstdir: dc.w 0
liftheighttab: ds.w 40
doorheighttab: ds.w 40
PLR1_stoodonlift: dc.b 0
PLR2_stoodonlift: dc.b 0
liftattop: dc.b 0
liftatbot: dc.b 0
DoorLocks: dc.w 0
LiftLocks: dc.w 0
ZoneBrightTable:
ds.l 300
DoWaterAnims:
move.w #20,d0
wateranimlop:
move.l (a0)+,d1
move.l (a0)+,d2
move.l (a0),d3
move.w 4(a0),d4
move.w d4,d5
muls TempFrames,d5
add.l d5,d3
cmp.l d1,d3
bgt.s waternotattop
move.l d1,d3
move.w #128,d4
bra waterdone
waternotattop:
cmp.l d2,d3
blt.s waterdone
move.l d2,d3
move.w #-128,d4
waterdone:
move.l d3,(a0)+
move.w d4,(a0)+
move.l d3,d1
morezones:
move.w (a0)+,d2
bge.s okzone
dbra d0,wateranimlop
rts
okzone:
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l d1,d3
asr.l #6,d3
move.w d3,2(a1)
move.l ZoneAdds,a1
move.l (a1,d2.w*4),a1
add.l LEVELDATA,a1
move.l d1,ToZoneWater(a1)
bra.s morezones
rts
FLOORMOVESPD: dc.w 0
even
LiftRoutine:
move.w #-1,ThisDoor
move.l LiftData,a0
move.l #liftheighttab,a6
doalift:
add.w #1,ThisDoor
move.w (a0)+,d0 ; bottom of lift movement
cmp.w #999,d0
bne notallliftsdone
move.w #999,(a6)
move.w #0,LiftLocks
bsr DoWaterAnims
rts
notallliftsdone:
move.w (a0)+,d1 ; top of lift movement.
move.w (a0)+,OPENINGSPEED
neg.w OPENINGSPEED
move.w (a0)+,CLOSINGSPEED
move.w (a0)+,STAYOPENFOR
move.w (a0)+,OPENINGSFX
move.w (a0)+,CLOSINGSFX
move.w (a0)+,OPENSFX
move.w (a0)+,CLOSEDSFX
subq.w #1,OPENINGSFX
subq.w #1,CLOSINGSFX
subq.w #1,OPENSFX
subq.w #1,CLOSEDSFX
move.w (a0)+,d2
move.w (a0)+,d3
sub.w p1_xoff,d2
sub.w p1_zoff,d3
move.w cosval,d4
move.w sinval,d5
muls d2,d4
muls d3,d5
sub.l d5,d4
add.l d4,d4
swap d4
move.w d4,Noisex
move.w sinval,d4
move.w cosval,d5
muls d2,d4
muls d3,d5
sub.l d5,d4
add.l d4,d4
swap d4
move.w d4,Noisez
move.w (a0),d3
move.w d3,(a6)+
move.w 2(a0),d2
move.w d2,d7 ; speed of movement.
move.w d2,FLOORMOVESPD
muls TempFrames,d2
add.w d2,d3
move.w d7,d2
cmp.w d3,d0
sle.s liftatbot
bgt.s .nolower
tst.w d2
beq.s .nonoise3
move.w #50,Noisevol
move.w CLOSEDSFX,Samplenum
blt.s .nonoise3
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
.nonoise3:
moveq #0,d2
move.w d0,d3
.nolower:
cmp.w d3,d1
sge.s liftattop
blt.s .noraise
tst.w d2
beq.s .nonoise
move.w #0,(a6)
move.w #50,Noisevol
move.w OPENSFX,Samplenum
blt.s .nonoise
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
.nonoise
moveq #0,d2
move.w d1,d3
.noraise:
sub.w d3,d0
cmp.w #15*16,d0
slt d6
move.w d3,(a0)+
move.l a0,a5
move.w d2,(a0)+
move.w d2,d7
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
asr.w #2,d3
move.w d3,d0
asl.w #2,d0
move.w d0,2(a1)
move.w d3,d0
muls #256,d3
move.w (a0)+,d5
move.l ZoneAdds,a1
move.l (a1,d5.w*4),a1
add.l LEVELDATA,a1
move.w (a1),d5
move.l PLR1_Roompt,a3
move.l d3,2(a1)
neg.w d0
cmp.w (a3),d5
seq.s PLR1_stoodonlift
bne.s .nosetfloorspd1
move.w FLOORMOVESPD,PLR1_FloorSpd
.nosetfloorspd1:
move.l PLR2_Roompt,a3
cmp.w (a3),d5
seq.s PLR2_stoodonlift
bne.s .nosetfloorspd2
move.w FLOORMOVESPD,PLR2_FloorSpd
.nosetfloorspd2:
move.w (a0)+,d2 ; conditions
; and.w Conditions,d2
; cmp.w -2(a0),d2
move.w ThisDoor,d2
move.w LiftLocks,d5
btst d2,d5
beq.s .satisfied
move.w (a0)+,d5
.dothesimplething:
move.l FloorLines,a3
.simplecheck:
move.w (a0)+,d5
blt nomoreliftwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w #0,14(a4)
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,20(a1)
bra.s .simplecheck
bra nomoreliftwalls
.satisfied:
move.l FloorLines,a3
moveq #0,d4
moveq #0,d5
move.b (a0)+,d4
move.b (a0)+,d5
tst.b liftattop
bne tstliftlower
tst.b liftatbot
bne tstliftraise
move.w #0,d1
backfromlift
and.w #255,d0
liftwalls:
move.w (a0)+,d5
blt nomoreliftwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w 14(a4),d4
move.w #$8000,14(a4)
and.w d1,d4
beq.s .nothinghit
move.w d7,(a5)
move.w #50,Noisevol
move.w ACTIONNOISE,Samplenum
blt.s .nothinghit
move.b #1,chanpick
st notifplaying
move.b #$fe,IDNUM
movem.l a0/a3/a4/d0/d1/d2/d3/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/a4/d0/d1/d2/d3/d6/d7
.nothinghit:
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,20(a1)
bra liftwalls
nomoreliftwalls
bra doalift
rts
tstliftlower:
move.w CLOSINGSFX,ACTIONNOISE
cmp.b #1,d5
blt.s lift0
beq.s lift1
cmp.b #3,d5
blt.s lift2
beq.s lift3
lift0:
moveq #0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
move.w CLOSINGSPEED,d7
tst.b PLR1_stoodonlift
beq.s .noplr1
move.w #$8000,d1
bra backfromlift
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
move.w CLOSINGSPEED,d7
tst.b PLR2_stoodonlift
beq.s .noplr2
move.w #$8000,d1
bra backfromlift
.noplr2:
bra backfromlift
lift1:
move.w CLOSINGSPEED,d7
tst.b PLR1_stoodonlift
bne.s lift1b
tst.b PLR2_stoodonlift
bne.s lift1b
move.w #%100100000000,d1
bra backfromlift
lift1b:
move.w #$8000,d1
bra backfromlift
lift2:
move.w #$8000,d1
move.w CLOSINGSPEED,d7
bra backfromlift
lift3:
move.w #$0,d1
bra backfromlift
tstliftraise:
move.w OPENINGSFX,ACTIONNOISE
cmp.b #1,d4
blt.s rlift0
beq.s rlift1
cmp.b #3,d4
blt.s rlift2
beq.s rlift3
rlift0:
moveq #0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
move.w OPENINGSPEED,d7
tst.b PLR1_stoodonlift
beq.s .noplr1
move.w #$8000,d1
bra backfromlift
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
move.w OPENINGSPEED,d7
tst.b PLR2_stoodonlift
beq.s .noplr2
move.w #$8000,d1
bra backfromlift
.noplr2:
bra backfromlift
rlift1:
move.w OPENINGSPEED,d7
tst.b PLR1_stoodonlift
bne.s rlift1b
tst.b PLR2_stoodonlift
bne.s rlift1b
move.w #%100100000000,d1
bra backfromlift
rlift1b:
move.w #$8000,d1
bra backfromlift
rlift2:
move.w #$8000,d1
move.w OPENINGSPEED,d7
bra backfromlift
rlift3:
move.w #$0,d1
bra backfromlift
animtimer: dc.w 2
doordir: dc.w -1
doorpos: dc.w -9
dooropen: dc.b 0
doorclosed: dc.b 0
ThisDoor: dc.w 0
OPENINGSPEED: dc.w 0
CLOSINGSPEED: dc.w 0
STAYOPENFOR: dc.w 0
OPENINGSFX: dc.w 0
CLOSINGSFX: dc.w 0
OPENSFX: dc.w 0
CLOSEDSFX: dc.w 0
even
DoorRoutine:
move.l #doorheighttab,a6
move.l DoorData,a0
move.w #-1,ThisDoor
doadoor:
add.w #1,ThisDoor
move.w (a0)+,d0 ; bottom of door movement
cmp.w #999,d0
bne notalldoorsdone
move.w #999,(a6)
move.w #0,DoorLocks
rts
notalldoorsdone:
move.w (a0)+,d1 ; top of door movement.
move.w (a0)+,OPENINGSPEED
neg.w OPENINGSPEED
move.w (a0)+,CLOSINGSPEED
move.w (a0)+,STAYOPENFOR
move.w (a0)+,OPENINGSFX
move.w (a0)+,CLOSINGSFX
move.w (a0)+,OPENSFX
move.w (a0)+,CLOSEDSFX
subq.w #1,OPENINGSFX
subq.w #1,CLOSINGSFX
subq.w #1,OPENSFX
subq.w #1,CLOSEDSFX
move.w (a0)+,d2
move.w (a0)+,d3
sub.w p1_xoff,d2
sub.w p1_zoff,d3
move.w cosval,d4
move.w sinval,d5
muls d2,d4
muls d3,d5
sub.l d5,d4
add.l d4,d4
swap d4
move.w d4,Noisex
move.w sinval,d4
move.w cosval,d5
muls d2,d4
muls d3,d5
sub.l d5,d4
add.l d4,d4
swap d4
move.w d4,Noisez
move.w (a0),d3
move.w 2(a0),d2
muls TempFrames,d2
add.w d2,d3
move.w 2(a0),d2
cmp.w d3,d0
sle.s doorclosed
bgt.s nolower
tst.w d2
beq.s .nonoise
move.w #50,Noisevol
move.w CLOSEDSFX,Samplenum
blt.s .nonoise
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
.nonoise
moveq #0,d2
move.w d3,d0
nolower:
cmp.w d3,d1
sge.s dooropen
blt.s noraise
tst.w d2
beq.s .nonoise
move.w #0,(a6)
move.w #50,Noisevol
move.w OPENSFX,Samplenum
blt.s .nonoise
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
.nonoise
move.w d1,d3
moveq #0,d2
noraise:
NOTMOVING:
sub.w d3,d0
cmp.w #15*16,d0
sge d6
move.w d3,(a0)+
move.l a0,a5
move.w d2,(a0)+
move.w d2,d7
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
asr.w #2,d3
move.w d3,d0
asl.w #2,d0
move.w d0,2(a1)
move.w d3,d0
muls #256,d3
move.l ZoneAdds,a1
move.w (a0)+,d5
move.l (a1,d5.w*4),a1
add.l LEVELDATA,a1
move.l d3,6(a1)
neg.w d0
and.w #255,d0
; add.w #64,d0
cmp.w PLR1_Zone,d5
bne.s NotGoBackUp
tst.b dooropen
bne.s NotGoBackUp
tst.w d2
blt.s NotGoBackUp
move.w #-16,d7
move.w #$8000,d1
move.w (a0)+,d2
move.w (a0)+,d5
bra backfromtst
NotGoBackUp:
move.w (a0)+,d2 ; conditions
; and.w Conditions,d2
move.w ThisDoor,d2
move.w DoorLocks,d5
btst d2,d5
beq.s satisfied
move.w (a0)+,d5
dothesimplething:
move.l FloorLines,a3
simplecheck:
move.w (a0)+,d5
blt nomoredoorwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w #0,14(a4)
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,24(a1)
bra.s simplecheck
bra nomoredoorwalls
satisfied:
moveq #0,d4
moveq #0,d5
move.b (a0)+,d5
move.b (a0)+,d4
tst.b dooropen
bne tstdoortoclose
tst.b doorclosed
bne tstdoortoopen
move.w #$0,d1
backfromtst:
move.l FloorLines,a3
doorwalls:
move.w (a0)+,d5
blt.s nomoredoorwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w 14(a4),d4
move.w #$8000,14(a4)
and.w d1,d4
beq.s nothinghit
move.w d7,(a5)
move.w #50,Noisevol
move.w ACTIONNOISE,Samplenum
blt.s nothinghit
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
nothinghit:
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,24(a1)
bra.s doorwalls
nomoredoorwalls
addq #2,a6
bra doadoor
rts
ACTIONNOISE: dc.w 0
tstdoortoopen:
move.w OPENINGSFX,ACTIONNOISE
cmp.w #1,d5
blt.s door0
beq.s door1
cmp.w #3,d5
blt.s door2
beq.s door3
cmp.w #5,d5
blt.s door4
beq.s door5
door0:
move.w #$0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
.noplr2:
move.w OPENINGSPEED,d7
bra backfromtst
door1:
move.w #%100100000000,d1
move.w OPENINGSPEED,d7
bra backfromtst
door2:
move.w #%10000000000,d1
move.w OPENINGSPEED,d7
bra backfromtst
door3:
move.w #%1000000000,d1
move.w OPENINGSPEED,d7
bra backfromtst
door4:
move.w #$8000,d1
move.w OPENINGSPEED,d7
bra backfromtst
door5:
move.w #$0,d1
bra backfromtst
tstdoortoclose:
move.w TempFrames,d1
add.w (a6),d1
move.w d1,(a6)
cmp.w STAYOPENFOR,d1
bge.s .oktoclose
move.w #1,d4
.oktoclose:
move.w CLOSINGSFX,ACTIONNOISE
tst.w d4
beq.s dclose0
bra.s dclose1
dclose0:
move.w CLOSINGSPEED,d7
move.w #$8000,d1
bra backfromtst
dclose1:
move.w #$0,d1
bra backfromtst
SwitchRoutine:
move.l SwitchData,a0
move.w #7,d0
move.l Points,a1
CheckSwitches
tst.b p1_spctap
bne p1_SpaceIsPressed
backtop2
tst.b p2_spctap
bne p2_SpaceIsPressed
backtoend
tst.b 2(a0)
beq nobutt
tst.b 10(a0)
beq nobutt
move.w TempFrames,d1
add.w d1,d1
add.w d1,d1
sub.b d1,3(a0)
bne nobutt
move.b #0,10(a0)
move.l 6(a0),a3
add.l LEVELGRAPHICS,a3
move.w #11,4(a3)
move.w (a3),d3
and.w #%00000111100,d3
move.w d3,(a3)
move.w #7,d3
sub.w d0,d3
addq #4,d3
move.w Conditions,d4
bclr d3,d4
move.w d4,Conditions
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #10,Samplenum
move.b #1,chanpick
st notifplaying
move.b #$fc,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
nobutt:
adda.w #14,a0
dbra d0,CheckSwitches
rts
p1_SpaceIsPressed:
move.w p1_xoff,d1
move.w p1_zoff,d2
move.w (a0),d3
blt .NotCloseEnough
move.w 4(a0),d3
lea (a1,d3.w*4),a2
move.w (a2),d3
add.w 4(a2),d3
asr.w #1,d3
move.w 2(a2),d4
add.w 6(a2),d4
asr.w #1,d4
sub.w d1,d3
muls d3,d3
sub.w d2,d4
muls d4,d4
add.l d3,d4
cmp.l #60*60,d4
bge .NotCloseEnough
move.l 6(a0),a3
add.l LEVELGRAPHICS,a3
move.w #11,4(a3)
move.w (a3),d3
and.w #%00000111100,d3
not.b 10(a0)
beq.s .switchoff
or.w #2,d3
.switchoff:
move.w d3,(a3)
move.w #7,d3
sub.w d0,d3
addq #4,d3
move.w Conditions,d4
bchg d3,d4
move.w d4,Conditions
move.b #0,3(a0)
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #10,Samplenum
move.b #1,chanpick
st notifplaying
move.b #$fc,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
.NotCloseEnough:
bra backtop2
p2_SpaceIsPressed:
move.w p2_xoff,d1
move.w p2_zoff,d2
move.w (a0),d3
blt .NotCloseEnough
move.w 4(a0),d3
lea (a1,d3.w*4),a2
move.w (a2),d3
add.w 4(a2),d3
asr.w #1,d3
move.w 2(a2),d4
add.w 6(a2),d4
asr.w #1,d4
sub.w d1,d3
muls d3,d3
sub.w d2,d4
muls d4,d4
add.l d3,d4
cmp.l #60*60,d4
bge .NotCloseEnough
move.l 6(a0),a3
add.l LEVELGRAPHICS,a3
move.w #11,4(a3)
move.w (a3),d3
and.w #%00000111100,d3
not.b 10(a0)
beq.s .switchoff
or.w #2,d3
.switchoff:
move.w d3,(a3)
move.w #7,d3
sub.w d0,d3
addq #4,d3
move.w Conditions,d4
bchg d3,d4
move.w d4,Conditions
movem.l a0/a1/d0,-(a7)
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #10,Samplenum
move.b #1,chanpick
st notifplaying
move.b #$fc,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
movem.l (a7)+,a0/a1/d0
.NotCloseEnough:
bra backtoend
prot1: dc.w 0
tempGotBigGun: dc.w 0
tempGunDamage: dc.w 0
tempGunNoise: dc.w 1
tempxoff: dc.w 0
tempzoff: dc.w 0
tempRoompt: dc.l 0
PLR1_GotBigGun: dc.w 0
PLR1_GunDamage: dc.w 0
PLR1_GunNoise: dc.w 0
PLR2_GotBigGun: dc.w 0
PLR2_GunDamage: dc.w 0
PLR2_GunNoise: dc.w 0
bulyspd: dc.w 0
closedist: dc.w 0
PLR1_ObsInLine:
ds.b 400
PLR2_ObsInLine:
ds.b 400
rotcount:
dc.w 0
shotvels: ds.l 20
include "NEWPLAYERSHOOT.s"
PLR1_GunFrame: dc.w 0
PLR2_GunFrame: dc.w 0
NUMZONES: dc.w 0
duh: dc.w 0
double: dc.w 0
ivescreamed: dc.w 0
ObjectHandler:
move.l #ObjWork,WORKPTR
move.l #DAMAGED,DAMAGEPTR
move.l ObjectData,a0
Objectloop:
tst.w (a0)
blt doneallobj
move.w 12(a0),GraphicRoom(a0)
move.b 16(a0),d0
cmp.b #1,d0
blt JUMPALIEN
beq JUMPOBJECT
cmp.b #2,d0
beq JUMPBULLET
doneobj:
dontworryyourprettyhead:
adda.w #64,a0
add.l #8,WORKPTR
add.l #2,DAMAGEPTR
bra Objectloop
doneallobj:
rts
JUMPALIEN
tst.w 12(a0)
blt.s .dontworry
tst.b numlives(a0)
beq.s .nolock
move.l DoorsHeld(a0),d0
or.l d0,DoorLocks
.nolock
tst.b worry(a0)
beq .dontworry
jsr ItsAnAlien
tst.w 12-64(a0)
blt.s .notanaux
move.w 12(a0),12-64(a0)
move.w 12(a0),GraphicRoom-64(a0)
.notanaux:
.dontworry
bra doneobj
JUMPOBJECT
tst.w 12(a0)
blt.s .dontworry
jsr ItsAnObject
.dontworry
bra doneobj
JUMPBULLET:
jsr ItsABullet
bra doneobj
ItsAGasPipe:
clr.b worry(a0)
move.w TempFrames,d0
tst.w ThirdTimer(a0)
ble.s maybeflame
sub.w d0,ThirdTimer(a0)
move.w #5,SecTimer(a0)
move.w #10,FourthTimer(a0)
rts
maybeflame:
sub.w d0,FourthTimer(a0)
blt.s yesflame
rts
yesflame:
move.w #10,FourthTimer(a0)
sub.w #1,SecTimer(a0)
bgt.s notdoneflame
move.w ObjTimer(a0),ThirdTimer(a0)
notdoneflame:
cmp.w #4,SecTimer(a0)
bne.s .nowhoosh
movem.l d0-d7/a0-a6,-(a7)
move.l #ObjRotated,a1
move.w (a0),d0
lea (a1,d0.w*8),a1
move.l (a1),Noisex
move.w #200,Noisevol
move.w #22,Samplenum
move.b #1,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
.nowhoosh:
; Gas pipe: facing direction is given by
; leved (perpendicular to wall) so
; just continuously spray out flame!
move.l NastyShotData,a5
move.w #19,d1
.findonefree
move.w 12(a5),d0
blt.s .foundonefree
adda.w #64,a5
dbra d1,.findonefree
rts
.foundonefree:
move.b #2,16(a5)
move.w 12(a0),12(a5)
move.w 4(a0),d0
sub.w #80,d0
move.w d0,4(a5)
ext.l d0
asl.l #7,d0
move.l d0,accypos(a5)
clr.b shotstatus(a5)
move.w #0,shotyvel(a5)
move.w (a0),d0
move.w (a5),d1
move.l ObjectPoints,a1
move.l (a1,d0.w*8),(a1,d1.w*8)
move.l 4(a1,d0.w*8),4(a1,d1.w*8)
move.b #3,shotsize(a5)
move.w #0,shotflags(a5)
move.w #0,shotgrav(a5)
move.b #7,shotpower(a5)
move.l #%100000100000,EnemyFlags(a5)
move.w #0,shotanim(a5)
move.w #0,shotlife(a5)
move.l #SineTable,a1
move.w Facing(a0),d0
move.w (a1,d0.w),d1
adda.w #2048,a1
move.w (a1,d0.w),d2
ext.l d1
ext.l d2
asl.l #4,d1
asl.l #4,d2
swap d1
swap d2
move.w d1,shotxvel(a5)
move.w d2,shotzvel(a5)
st worry(a5)
rts
; include "ab3:source/AI.s"
ItsABarrel:
clr.b worry(a0)
move.w 12(a0),GraphicRoom(a0)
cmp.w #8,8(a0)
bne.s notexploding
add.w #$404,6(a0)
move.w 10(a0),d0
add.w #1,d0
cmp.w #8,d0
bne.s .notdone
move.w #-1,12(a0)
move.w #-1,GraphicRoom(a0)
rts
.notdone:
move.w d0,10(a0)
rts
notexploding:
move.w #$1f1f,14(a0)
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #60,d0
move.w d0,4(a0)
moveq #0,d2
move.b damagetaken(a0),d2
beq.s nodamage
move.b #0,damagetaken(a0)
sub.b d2,numlives(a0)
bgt.s nodamage
move.b #0,numlives(a0)
movem.l d0-d7/a0-a6,-(a7)
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),Viewerx
move.w 4(a1,d0.w*8),Viewerz
move.w #40,d0
jsr ComputeBlast
move.w (a0),d0
move.l #ObjRotated,a1
move.l (a1,d0.w*8),Noisex
move.w #300,Noisevol
move.w #15,Samplenum
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
move.w #8,8(a0)
move.w #0,10(a0)
move.w #$2020,14(a0)
move.w #-30,2(a0)
rts
nodamage:
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),Viewerx
move.w 4(a1,d0.w*8),Viewerz
move.b ObjInTop(a0),ViewerTop
move.b PLR1_StoodInTop,TargetTop
move.l PLR1_Roompt,ToRoom
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l a1,FromRoom
move.w PLR1_xoff,Targetx
move.w PLR1_zoff,Targetz
move.l PLR1_yoff,d0
asr.l #7,d0
move.w d0,Targety
move.w 4(a0),Viewery
jsr CanItBeSeen
clr.b 17(a0)
tst.b CanSee
beq .noseeplr1
move.b #1,17(a0)
.noseeplr1:
move.b PLR2_StoodInTop,TargetTop
move.l PLR2_Roompt,ToRoom
move.w PLR2_xoff,Targetx
move.w PLR2_zoff,Targetz
move.l PLR2_yoff,d0
asr.l #7,d0
move.w d0,Targety
move.w 4(a0),Viewery
jsr CanItBeSeen
tst.b CanSee
beq .noseeplr2
or.b #2,17(a0)
.noseeplr2:
rts
include "ab3:CHEESESAUCE/NEWaliencontrol.s"
nextCPt: dc.w 0
RipTear: dc.l 256*17*65536
otherrip: dc.l 256*18*65536
ItsAMediKit:
clr.b worry(a0)
move.w 12(a0),GraphicRoom(a0)
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #32,d0
move.w d0,4(a0)
HealFactor EQU 18
cmp.w #127,PLR1_energy
bge .NotSameZone
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
jsr CheckHit
tst.b hitwall
beq .NotPickedUp
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w #-1,GraphicRoom(a0)
move.w HealFactor(a0),d0
add.w PLR1_energy,d0
cmp.w #127,d0
ble.s .okokokokokok
move.w #127,d0
.okokokokokok:
move.w d0,PLR1_energy
.NotPickedUp:
.NotSameZone:
MEDIPLR2
cmp.w #127,PLR2_energy
bge .NotSameZone
move.b PLR2_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR2_xoff,oldx
move.w PLR2_zoff,oldz
move.w PLR2_Zone,d7
move.w 12(a0),d0
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
jsr CheckHit
tst.b hitwall
beq .NotPickedUp
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w #-1,GraphicRoom(a0)
move.w HealFactor(a0),d0
add.w PLR2_energy,d0
cmp.w #127,d0
ble.s .okokokokokok
move.w #127,d0
.okokokokokok:
move.w d0,PLR2_energy
.NotPickedUp:
.NotSameZone:
rts
OFFSETTOGRAPH:
dc.l (40*8)*43+10
dc.l (40*8)*11+12
dc.l (40*8)*11+22
dc.l (40*8)*43+24
AmmoInGuns:
dc.w 0
dc.w 5
dc.w 1
dc.w 0
dc.w 1
dc.w 0
dc.w 0
dc.w 5
ItsAKey:
move.w #$0f0f,14(a0)
tst.b NASTY
bne .yesnas
move.w #-1,12(a0)
rts
.yesnas:
move.w 12(a0),GraphicRoom(a0)
clr.b worry(a0)
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l 2(a1),d0
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
jsr CheckHit
tst.b hitwall
beq .NotPickedUp
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w #-1,GraphicRoom(a0)
move.b 17(a0),d0
or.b d0,Conditions+1
move.l Panel,a2
moveq #0,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
.done
move.l #OFFSETTOGRAPH,a1
add.l (a1,d1.w*4),a2
move.l #PanelKeys,a1
muls #6*22*8,d1
adda.w d1,a1
move.w #22*8-1,d0 ;lines
.lines:
move.l (a1)+,d1
or.l d1,(a2)
move.w (a1)+,d1
or.w d1,4(a2)
adda.w #40,a2
dbra d0,.lines
.NotPickedUp:
.NotSameZone:
rts
Conditions: dc.l 0
; Format of animations:
; Size (-1 = and of anim) (w)
; Address of Frame. (l)
; height offset (w)
Bul1Anim:
dc.w 20*256+15
dc.w 6,8
dc.w 0
dc.w 17*256+17
dc.w 6,9
dc.w 0
dc.w 15*256+20
dc.w 6,10
dc.w 0
dc.w 17*256+17
dc.w 6,11
dc.w 0
dc.l -1
Bul1Pop
dc.b 25,25
dc.w 1,6
dc.w 0
dc.b 25,25
dc.w 1,7
dc.w -4
dc.b 25,25
dc.w 1,8
dc.w -4
dc.b 25,25
dc.w 1,9
dc.w -4
dc.b 25,25
dc.w 1,10
dc.w -4
dc.b 25,25
dc.w 1,11
dc.w -4
dc.b 25,25
dc.w 1,12
dc.w -4
dc.b 25,25
dc.w 1,13
dc.w -4
dc.b 25,25
dc.w 1,14
dc.w -4
dc.b 25,25
dc.w 1,15
dc.w -4
dc.b 25,25
dc.w 1,16
dc.w -4
dc.l -1
Bul3Anim:
dc.b 25,25
dc.w 0,12
dc.w 0
dc.b 25,25
dc.w 0,13
dc.w 0
dc.b 25,25
dc.w 0,14
dc.w 0
dc.b 25,25
dc.w 0,15
dc.w 0
dc.l -1
Bul3Pop:
dc.l -1
Bul4Anim:
dc.b 25,25
dc.w 6,4
dc.w 0
dc.b 25,25
dc.w 6,5
dc.w 0
dc.b 25,25
dc.w 6,6
dc.w 0
dc.b 25,25
dc.w 6,7
dc.w 0
dc.l -1
Bul4Pop:
dc.b 20,20
dc.w 6,4
dc.w 0
dc.b 15,15
dc.w 6,5
dc.w 0
dc.b 10,10
dc.w 6,6
dc.w 0
dc.b 5,5
dc.w 6,7
dc.w 0
dc.l -1
Bul5Anim:
dc.b 10,10
dc.w 6,4
dc.w 0
dc.b 10,10
dc.w 6,5
dc.w 0
dc.b 10,10
dc.w 6,6
dc.w 0
dc.b 10,10
dc.w 6,7
dc.w 0
dc.l -1
Bul5Pop:
dc.b 8,8
dc.w 6,4
dc.w 0
dc.b 6,6
dc.w 6,5
dc.w 0
dc.b 4,4
dc.w 6,6
dc.w 0
dc.l -1
grenAnim:
dc.b 25,25
dc.w 1,21
dc.w 0
dc.b 25,25
dc.w 1,22
dc.w 0
dc.b 25,25
dc.w 1,23
dc.w 0
dc.b 25,25
dc.w 1,24
dc.w 0
dc.l -1
Bul2Anim:
dc.b 25,25
dc.w -18,4
dc.w 0
dc.b 25,25
dc.w -18,5
dc.w 0
dc.b 25,25
dc.w -18,6
dc.w 0
dc.b 25,25
dc.w -18,7
dc.w 0
dc.b 25,25
dc.w -18,4
dc.w 0
dc.b 25,25
dc.w -18,5
dc.w 0
dc.b 25,25
dc.w -18,6
dc.w 0
dc.b 25,25
dc.w -18,7
dc.w 0
dc.w -1
Bul2Pop:
dc.b 25,25
dc.w 2,8
dc.w -4
dc.b 29,29
dc.w 2,9
dc.w -4
dc.b 33,33
dc.w 2,10
dc.w -4
dc.b 37,37
dc.w 2,11
dc.w -4
dc.b 41,41
dc.w 2,12
dc.w -4
dc.b 45,45
dc.w 2,13
dc.w -4
dc.b 49,49
dc.w 2,14
dc.w -4
dc.b 53,53
dc.w 2,15
dc.w -4
dc.b 57,57
dc.w 2,16
dc.w -4
dc.b 61,61
dc.w 2,17
dc.w -4
dc.b 65,65
dc.w 2,18
dc.w -4
dc.b 69,69
dc.w 2,19
dc.w -4
dc.w -1
RockAnim:
dc.b 16,16
dc.w 6,0
dc.w 0
dc.b 16,16
dc.w 6,1
dc.w 0
dc.b 16,16
dc.w 6,2
dc.w 0
dc.b 16,16
dc.w 6,3
dc.w 0
dc.l -1
val SET 100
RockPop:
dc.b val,val
dc.w 8,0
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,1
dc.w 0
val SET val+10
dc.b val,val
dc.w 8,2
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,3
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,4
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,4
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,5
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,5
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,6
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,6
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,7
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,7
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,8
dc.w -4
val SET val+10
dc.b val,val
dc.w 8,8
dc.w -4
dc.l -1
val SET 5
FlameAnim:
dc.b val,val
dc.w 8,0
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,1
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,2
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,3
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,4
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,4
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,5
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,5
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,5
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,6
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,6
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,6
dc.w 0
val SET val+6
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,8
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,8
dc.w 0
val SET val+8
dc.b val,val
dc.w 8,8
dc.w 0
dc.l -1
FlamePop:
val SET 4*35
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,7
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,8
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,8
dc.w 0
val SET val+4
dc.b val,val
dc.w 8,8
dc.w 0
dc.l -1
Explode1Anim:
dc.b 25,25
dc.w 0,16
dc.w 0
dc.b 25,25
dc.w 0,17
dc.w 0
dc.b 25,25
dc.w 0,18
dc.w 0
dc.b 25,25
dc.w 0,19
dc.w 0
dc.l -1
Explode1Pop:
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 17,17
dc.w 0,16
dc.w 1
dc.b 13,13
dc.w 0,16
dc.w 1
dc.b 9,9
dc.w 0,16
dc.w 1
dc.l -1
Explode2Anim:
dc.b 20,20
dc.w 0,20
dc.w 0
dc.b 20,20
dc.w 0,21
dc.w 0
dc.b 20,20
dc.w 0,22
dc.w 0
dc.b 20,20
dc.w 0,23
dc.w 0
dc.l -1
Explode2Pop:
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 17,17
dc.w 0,20
dc.w 1
dc.b 13,13
dc.w 0,20
dc.w 1
dc.b 9,9
dc.w 0,20
dc.w 1
dc.l -1
Explode3Anim:
dc.b 20,20
dc.w 0,24
dc.w 0
dc.b 20,20
dc.w 0,25
dc.w 0
dc.b 20,20
dc.w 0,26
dc.w 0
dc.b 20,20
dc.w 0,27
dc.w 0
dc.l -1
Explode3Pop:
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 13,13
dc.w 0,24
dc.w 1
dc.b 9,9
dc.w 0,24
dc.w 1
dc.l -1
Explode4Anim:
dc.b 30,30
dc.w 0,28
dc.w 0
dc.b 30,30
dc.w 0,29
dc.w 0
dc.b 30,30
dc.w 0,30
dc.w 0
dc.b 30,30
dc.w 0,31
dc.w 0
dc.l -1
Explode4Pop:
dc.b 20,20
dc.w 0,28
dc.w 0
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 17,17
dc.w 0,28
dc.w 1
dc.b 13,13
dc.w 0,28
dc.w 1
dc.b 9,9
dc.w 0,28
dc.w 1
dc.l -1
BulletSizes:
dc.w $0f0f,$707
dc.w $0f0f,$f0f
dc.w $0f0f,$1f1f
dc.w $1f1f,$1f1f
dc.w $0707,$1f1f
dc.w $0f0f,$0f0f
dc.w $0f0f,$0f0f
dc.w $707,$707
dc.w 0,0,0,0
;10
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
;20
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
;30
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
;40
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
;50
dc.w $0707,$0707,$0707,$0707
dc.w $0707,$0707,$0707,$0707
HitNoises:
; dc.l -1,-1
dc.w 15,200
dc.w 15,200
dc.l -1
dc.w 15,200
dc.l -1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.w 13,50,13,50,13,50,13,50
ExplosiveForce:
dc.w 0,0,64,0,40,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0
BulletTypes:
dc.l Bul1Anim,Bul1Pop
dc.l Bul2Anim,Bul2Pop
dc.l RockAnim,RockPop
dc.l FlameAnim,FlamePop
dc.l grenAnim,RockPop
dc.l Bul4Anim,Bul4Pop
dc.l Bul5Anim,Bul5Pop
dc.l Bul1Anim,Bul1Pop
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l Explode1Anim,Explode1Pop
dc.l Explode2Anim,Explode2Pop
dc.l Explode3Anim,Explode3Pop
dc.l Explode4Anim,Explode4Pop
tsta: dc.l 0
timeout: dc.w 0
BRIGHTNESS: dc.w 0
ItsABullet:
move.b #0,timeout
move.w 12(a0),d0
move.w d0,GraphicRoom(a0)
blt doneshot
moveq #0,d1
move.b shotsize(a0),d1
muls #B_BulStatLen,d1
move.l LINKFILE,a6
lea BulletAnimData(a6),a6
add.l d1,a6
tst.b shotstatus(a0)
bne.s noworrylife
; a6 points at bullet data.
move.w shotlife(a0),d2
blt.s infinite
move.l B_LifeTime(a6),d1
blt.s infinite
cmp.w d2,d1
bge.s notdone
st timeout
bra.s infinite
notdone:
move.w TempFrames,d2
add.w d2,shotlife(a0)
infinite:
noworrylife:
move.w #0,extlen
move.b #$ff,awayfromwall
tst.b shotstatus(a0)
beq notpopping
lea B_StartOfPop(a6),a1
moveq #0,d1
move.b shotanim(a0),d1
move.w d1,d2
add.w d1,d1
add.w d2,d1
add.w d1,d1
move.l #0,8(a0)
cmp.l #1,B_ImpactGraphicType(a6)
blt.s .bitmapgraph
beq.s .glaregraph
.additivegraph:
move.b (a1,d1.w),9(a0)
move.b 1(a1,d1.w),11(a0)
move.b #6,10(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
bra.s .donegraph
.bitmapgraph:
move.b (a1,d1.w),9(a0)
move.b 1(a1,d1.w),11(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
bra.s .donegraph
.glaregraph:
move.b (a1,d1.w),d0
ext.w d0
neg.w d0
move.w d0,8(a0)
move.b 1(a1,d1.w),11(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
.donegraph:
addq #1,d2
cmp.w B_PopFrames+2(a6),d2
ble.s notdonepopping
move.w #-1,12(a0)
move.w #-1,GraphicRoom(a0)
clr.b shotstatus(a0)
move.b #0,shotanim(a0)
rts
notdonepopping:
move.b d2,shotanim(a0)
moveq #0,d0
move.b BRIGHTNESS,d0
beq.s .nobright
neg.w d0
move.w (a0),d2
move.l ObjectPoints,a2
move.w (a2,d2.w*8),d1
move.w 4(a2,d2.w*8),d2
move.w 4(a0),d3
ext.l d3
asl.l #7,d3
move.l d3,BRIGHTY
move.w 12(a0),d3
jsr BRIGHTENPOINTS
.nobright
rts
BLOODYGREATBOMB: dc.w 0
notpopping:
move.b shotsize(a0),BLOODYGREATBOMB
lea B_StartOfAnim(a6),a1
moveq #0,d1
move.b shotanim(a0),d1
add.w d1,d1
move.w d1,d2
add.w d1,d1
add.w d2,d1
move.l #0,8(a0)
cmp.l #1,B_GraphType(a6)
blt.s .bitmapgraph
beq.s .glaregraph
.additivegraph:
move.b (a1,d1.w),9(a0)
move.b 1(a1,d1.w),11(a0)
move.b #6,10(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
bra.s .donegraph
.bitmapgraph:
move.b (a1,d1.w),9(a0)
move.b 1(a1,d1.w),11(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
bra.s .donegraph
.glaregraph:
move.b (a1,d1.w),d0
ext.w d0
neg.w d0
move.w d0,8(a0)
move.b 1(a1,d1.w),11(a0)
move.w 2(a1,d1.w),6(a0)
move.b 5(a1,d1.w),BRIGHTNESS
.donegraph:
addq #1,d2
cmp.w B_AnimFrames+2(a6),d2
ble.s notdoneanim
move.w #0,d2
notdoneanim:
move.b d2,shotanim(a0)
move.l ZoneAdds,a2
move.l (a2,d0.w*4),d0
add.l LEVELDATA,d0
move.l d0,objroom
********************************
move.l objroom,a3
tst.b ObjInTop(a0)
beq.s .notintop
adda.w #8,a3
.notintop:
move.l 6(a3),d0
sub.l accypos(a0),d0
cmp.l #10*128,d0
blt .nohitroof
btst #0,shotflags+1(a0)
beq.s .nobounce
neg.w shotyvel(a0)
move.l 6(a3),d0
add.l #10*128,d0
move.l d0,accypos(a0)
; btst #1,shotflags+1(a0)
; beq .nohitroof
move.l shotxvel(a0),d0
asr.l #1,d0
move.l d0,shotxvel(a0)
move.l shotzvel(a0),d0
asr.l #1,d0
move.l d0,shotzvel(a0)
bra .nohitroof
.nobounce:
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
move.l B_ImpactSFX(a6),d0
subq.l #1,d0
blt.s .nohitnoise
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
; move.w d0,Noisevol
; swap d0
move.w #200,Noisevol
move.w d0,Samplenum
move.b d1,IDNUM
movem.l d0-d7/a0-a6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
.nohitnoise:
move.l B_ExplosiveForce(a6),d0
beq.s .noexplosion
move.w newx,Viewerx
move.w newz,Viewerz
move.w 4(a0),Viewery
move.b ObjInTop(a0),ViewerTop
movem.l d0-d7/a0-a6,-(a7)
bsr ComputeBlast
movem.l (a7)+,d0-d7/a0-a6
.noexplosion:
.nohitroof:
move.l 2(a3),d0
sub.l accypos(a0),d0
cmp.l #10*128,d0
bgt .nohitfloor
tst.l B_BounceOffFloors(a6)
beq.s .nobounceup
tst.w shotyvel(a0)
blt .nohitfloor
moveq #0,d0
move.w shotyvel(a0),d0
asr.w #1,d0
neg.w d0
move.w d0,shotyvel(a0)
move.l 2(a3),d0
sub.l #10*128,d0
move.l d0,accypos(a0)
; btst #1,shotflags+1(a0)
; beq .nohitfloor
move.l shotxvel(a0),d0
asr.l #1,d0
move.l d0,shotxvel(a0)
move.l shotzvel(a0),d0
asr.l #1,d0
move.l d0,shotzvel(a0)
bra .nohitfloor
.nobounceup:
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
move.l B_ImpactSFX(a6),d0
subq.l #1,d0
blt.s .nohitnoise2
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w #200,Noisevol
move.w d0,Samplenum
move.b d1,IDNUM
movem.l d0-d7/a0-a6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
.nohitnoise2:
moveq #0,d0
move.l B_ExplosiveForce(a6),d0
beq.s .noexplosion2
move.w 4(a0),Viewery
move.w newx,Viewerx
move.w newz,Viewerz
move.b ObjInTop(a0),ViewerTop
movem.l d0-d7/a0-a6,-(a7)
bsr ComputeBlast
movem.l (a7)+,d0-d7/a0-a6
.noexplosion2:
.nohitfloor:
********************
move.l ObjectPoints,a1
move.w (a0),d1
lea (a1,d1.w*8),a1
move.l (a1),d2
move.l d2,oldx
move.l shotxvel(a0),d3
move.w d3,d4
swap d3
move.w TempFrames,d5
muls d5,d3
mulu d5,d4
swap d3
clr.w d3
add.l d4,d3
add.l d3,d2
move.l d2,newx
move.l 4(a1),d2
move.l d2,oldz
move.l shotzvel(a0),d3
move.w d3,d4
swap d3
muls d5,d3
mulu d5,d4
swap d3
clr.w d3
add.l d4,d3
add.l d3,d2
move.l d2,newz
move.l accypos(a0),oldy
move.w shotyvel(a0),d3
muls TempFrames,d3
move.l B_Gravity(a6),d5
beq.s nograv
muls TempFrames,d5
add.l d5,d3
move.w shotyvel(a0),d6
ext.l d6
add.l d5,d6
cmp.l #10*256,d6
blt.s okgrav
move.l #10*256,d6
okgrav:
move.w d6,shotyvel(a0)
nograv:
move.l accypos(a0),d4
add.l d3,d4
move.l d4,accypos(a0)
sub.l #5*128,d4
move.l d4,newy
add.l #5*128,d4
asr.l #7,d4
move.w d4,4(a0)
tst.l B_BounceOffWalls(a6)
sne.s wallbounce
seq.s exitfirst
clr.b hitwall
move.b ObjInTop(a0),StoodInTop
move.w #%0000010000000000,wallflags
move.l #0,StepUpVal
move.l #$1000000,StepDownVal
move.l #10*128,thingheight
move.w oldx,d0
cmp.w newx,d0
bne.s lalal
move.w oldz,d0
cmp.w newz,d0
beq.s nomovebul
move.w #1,walllength
lalal:
movem.l d0/d7/a0/a1/a2/a4/a5/a6,-(a7)
jsr MoveObject
moveq #0,d0
move.b BRIGHTNESS,d0
beq.s .nobright
neg.w d0
move.w newx,d1
move.w newz,d2
move.l newy,BRIGHTY
move.l objroom,a0
move.w (a0),d3
jsr BRIGHTENPOINTS
.nobright:
movem.l (a7)+,d0/d7/a0/a1/a2/a4/a5/a6
nomovebul:
move.b StoodInTop,ObjInTop(a0)
tst.b wallbounce
beq.s .notabouncything
tst.b hitwall
beq .nothitwall
; we have hit a wall....
move.w shotzvel(a0),d0
muls wallxsize,d0
move.w shotxvel(a0),d1
muls wallzsize,d1
sub.l d1,d0
divs walllength,d0
move.w shotxvel(a0),d1
move.w wallzsize,d2
add.w d2,d2
muls d0,d2
divs walllength,d2
add.w d2,d1
move.w d1,shotxvel(a0)
move.w shotzvel(a0),d1
move.w wallxsize,d2
add.w d2,d2
muls d0,d2
divs walllength,d2
sub.w d2,d1
move.w d1,shotzvel(a0)
; btst #1,shotflags+1(a0)
; beq .nothitwall
move.l shotxvel(a0),d0
asr.l #1,d0
move.l d0,shotxvel(a0)
move.l shotzvel(a0),d0
asr.l #1,d0
move.l d0,shotzvel(a0)
bra .nothitwall
.notabouncything:
tst.b hitwall
beq .nothitwall
move.l wallhitheight,d4
move.l d4,accypos(a0)
asr.l #7,d4
move.w d4,4(a0)
.hitsomething
clr.b timeout
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
move.l B_ImpactSFX(a6),d0
subq.l #1,d0
blt.s .nohitnoise
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w #200,Noisevol
move.w d0,Samplenum
move.b d1,IDNUM
movem.l d0-d7/a0-a6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
.nohitnoise:
move.l B_ExplosiveForce(a6),d0
beq.s .noexplosion
move.w newx,Viewerx
move.w newz,Viewerz
move.w 4(a0),Viewery
move.b ObjInTop(a0),ViewerTop
movem.l d0-d7/a0-a6,-(a7)
bsr ComputeBlast
movem.l (a7)+,d0-d7/a0-a6
.noexplosion:
; bra doneshot
; rts
.nothitwall:
tst.b timeout
bne .hitsomething
lab:
move.l objroom,a3
move.w (a3),12(a0)
move.w (a3),GraphicRoom(a0)
move.l newx,(a1)
move.l newz,4(a1)
************
* Check if hit a nasty
tst.l EnemyFlags(a0)
bne.s notasplut
rts
notasplut:
move.l ObjectData,a3
move.l ObjectPoints,a1
move.w newx,d2
sub.w oldx,d2
move.w d2,xdiff
move.w newz,d1
sub.w oldz,d1
move.w d1,zdiff
move.w d1,d3
move.w d2,d4
muls d2,d2
muls d1,d1
move.l #1,d0
add.l d1,d2
beq .oksqr
move.w #31,d0
.findhigh
btst d0,d2
bne .foundhigh
dbra d0,.findhigh
.foundhigh
asr.w #1,d0
clr.l d3
bset d0,d3
move.l d3,d0
move.w d0,d1
muls d1,d1 ; x*x
sub.l d2,d1 ; x*x-a
asr.l #1,d1 ; (x*x-a)/2
divs d0,d1 ; (x*x-a)/2x
sub.w d1,d0 ; second approx
bgt .stillnot0
move.w #1,d0
.stillnot0
move.w d0,d1
muls d1,d1
sub.l d2,d1
asr.l #1,d1
divs d0,d1
sub.w d1,d0 ; second approx
bgt .stillnot02
move.w #1,d0
.stillnot02
move.w d0,d1
muls d1,d1
sub.l d2,d1
asr.l #1,d1
divs d0,d1
sub.w d1,d0 ; second approx
bgt .stillnot03
move.w #1,d0
.stillnot03
.oksqr
move.w d0,Range
add.w #80,d0
muls d0,d0
move.l d0,sqrnum
.checkloop:
tst.w (a3)
blt .checkedall
tst.w 12(a3)
blt .notanasty
moveq #0,d1
move.b 16(a3),d1
move.l EnemyFlags(a0),d7
btst d1,d7
beq .notanasty
cmp.b #1,d1
bne.s .notanobj
move.l LINKFILE,a4
add.l #ObjectStats,a4
move.b TypeOfThing(a3),d1
muls #ObjectStatLen,d1
cmp.w #2,O_Behaviour(a4,d1.w)
bne .notanasty
.notanobj:
tst.b numlives(a3)
beq .notanasty
; move.l #ColBoxTable,a6
; lea (a6,d1.w*8),a6
move.w 4(a3),d1
move.w 4(a0),d2
sub.w d1,d2
bge .okh
neg.w d2
.okh:
; cmp.w 2(a6),d2
cmp.w #50,d2
bgt .notanasty
move.w (a3),d1
move.w (a1,d1.w*8),d2
move.w d2,d4
move.w 4(a1,d1.w*8),d3
move.w d3,d5
sub.w newx,d4
sub.w oldx,d2
move.w d2,d6
sub.w newz,d5
sub.w oldz,d3
move.w d3,d7
muls zdiff,d6
muls xdiff,d7
sub.l d7,d6
bgt.s .pos
neg.l d6
.pos:
divs Range,d6
move.w #80,d7
cmp.b #1,16(a3)
ble.s .okbig
move.w #40,d7
.okbig:
cmp.w d7,d6
; cmp.w (a6),d6
bgt .stillgoing
muls d2,d2
muls d3,d3
add.l d3,d2
cmp.l sqrnum,d2
bgt .stillgoing
muls d4,d4
muls d5,d5
add.l d5,d4
cmp.l sqrnum,d4
bgt .stillgoing
move.b shotpower(a0),d6
add.b d6,damagetaken(a3)
move.w shotxvel(a0),ImpactX(a3)
move.w shotzvel(a0),ImpactZ(a3)
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
move.l B_ImpactSFX(a6),d0
subq.l #1,d0
blt.s .nohitnoise3
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w #200,Noisevol
move.w d0,Samplenum
move.b d1,IDNUM
movem.l d0-d7/a0-a6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
.nohitnoise3:
move.l B_ExplosiveForce(a6),d0
beq.s .noexplosion3
move.w 4(a0),Viewery
move.w newx,Viewerx
move.w newz,Viewerz
movem.l d0-d7/a0-a6,-(a7)
bsr ComputeBlast
movem.l (a7)+,d0-d7/a0-a6
.noexplosion3:
bra .hitnasty
.stillgoing:
.notanasty:
add.w #64,a3
bra .checkloop
.hitnasty:
.checkedall
doneshot:
rts
tmpnewx: dc.l 0
tmpnewz: dc.l 0
hithit: dc.l 0
sqrnum: dc.l 0
tmpangpos: dc.l 0
allbars: dc.l 0
backrout: ds.b 800
NUMTOCHECK: dc.w 0
MAKEBACKROUT:
; move.l #backrout+256,d0
; clr.b d0
; move.l d0,allbars
; move.l d0,a1
; move.l #fromback,a0
; move.w #400,d0
;putinback:
; move.b (a0)+,(a1)+
; dbra d0,putinback
rts
****************************************
ifeq CHEESEY
putinbackdrop:
move.l a0,-(a7)
move.w tmpangpos,d5
and.w #4095,d5
muls #648,d5
divs #4096,d5
muls #240,d5
; CACHE_ON d1
tst.b FULLSCR
bne BIGBACK
move.l FASTBUFFER,a0
move.l #EndBackPicture,a3
move.l #BackPicture+240,a5
lea.l BackPicture,a1
add.l d5,a1
add.w #240,a1
move.w MIDDLEY,d7
move.w d7,d6
move.w d6,d5
asr.w #1,d5
add.w d5,d6
sub.w d6,a1
sub.w d6,a5
asr.w #2,d7
move.w #240,d1
move.w #240,d2
move.w #480,d5
move.w #191,d4
horline:
move.w d7,d3
move.l a0,a2
move.l a1,a4
vertline:
move.w (a4)+,d0
move.b d0,(a2)
move.b (a4)+,d0
move.b d0,320(a2)
addq #1,a4
move.b (a4)+,d0
move.b d0,320*2(a2)
move.b (a4)+,d0
move.b d0,320*3(a2)
adda.w #320*4,a2
dbra d3,vertline
add.w d1,a1
cmp.l a1,a3
bgt.s .noend
move.l a5,a1
.noend
exg d1,d2
exg d2,d5
addq.w #1,a0
dbra d4,horline
move.l (a7)+,a0
rts
BIGBACK:
move.l FASTBUFFER,a0
move.l #EndBackPicture,a3
move.l #BackPicture+240,a5
lea.l BackPicture,a1
add.l d5,a1
add.w #240,a1
move.w MIDDLEY,d7
move.w d7,d6
sub.w d6,a1
sub.w d6,a5
asr.w #2,d7
move.w #287,d4
.horline:
move.w d7,d3
move.l a0,a2
move.l a1,a4
.vertline:
move.l (a4)+,d0
move.b d0,320*3(a2)
swap d0
move.b d0,320(a2)
lsr.l #8,d0
move.b d0,(a2)
swap d0
move.b d0,320*2(a2)
adda.w #320*4,a2
dbra d3,.vertline
add.w #240,a1
cmp.l a1,a3
bgt.s .noend
move.l a5,a1
.noend
addq.w #1,a0
dbra d4,.horline
move.l (a7)+,a0
rts
****************************************
endc
ifne CHEESEY
putinbackdrop:
move.l a0,-(a7)
move.w tmpangpos,d5
and.w #4095,d5
muls #648,d5
divs #4096,d5
;xoffset of backdrop
; CACHE_ON d1
tst.b FULLSCR
bne BIGBACK
move.l FASTBUFFER,a0
add.l d5,a1
add.w #240,a1
move.w MIDDLEY,d7
move.w d7,d6
move.w d6,d5
asr.w #1,d5
add.w d5,d6
sub.w d6,a1
sub.w d6,a5
asr.w #2,d7
move.w #240,d1
move.w #240,d2
move.w #480,d5
move.w #(192/8)-1,d4
moveq #0,d0
horline:
move.w d7,d3
move.l a0,a2
move.l a1,a4
vertline:
move.l d0,(a2)
move.l d0,320(a2)
move.l d0,320*2(a2)
move.l d0,320*3(a2)
move.l d0,4(a2)
move.l d0,4+320(a2)
move.l d0,4+(320*2)(a2)
move.l d0,4+(320*3)(a2)
adda.w #320*4,a2
dbra d3,vertline
addq.w #8,a0
dbra d4,horline
move.l (a7)+,a0
rts
BIGBACK:
move.l FASTBUFFER,a0
add.l d5,a1
add.w #240,a1
move.w MIDDLEY,d7
move.w d7,d6
sub.w d6,a1
sub.w d6,a5
asr.w #2,d7
move.w #(288/8)-1,d4
move.l #0,d0
.horline:
move.w d7,d3
move.l a0,a2
move.l a1,a4
.vertline:
move.l d0,320*0(a2)
move.l d0,320*1(a2)
move.l d0,320*2(a2)
move.l d0,320*3(a2)
move.l d0,4+320*0(a2)
move.l d0,4+320*1(a2)
move.l d0,4+320*2(a2)
move.l d0,4+320*3(a2)
adda.w #320*4,a2
dbra d3,.vertline
addq #8,a0
dbra d4,.horline
move.l (a7)+,a0
rts
endc
MaxDamage: dc.w 0
ComputeBlast:
clr.w doneflames
move.w d0,d6
move.w d0,MaxDamage
move.w d0,d1
ext.l d6
neg.w d1
move.w 12(a0),d0
; jsr Flash
move.l ZoneAdds,a2
move.l (a2,d0.w*4),a2
add.l LEVELDATA,a2
move.l a2,MiddleRoom
move.l ObjectData,a2
suba.w #64,a2
ext.l d6
move.l a0,-(a7)
HitObjLoop:
move.l MiddleRoom,FromRoom
add.w #64,a2
move.w (a2),d0
blt CheckedEmAll
tst.w 12(a2)
blt.s HitObjLoop
moveq #0,d1
move.b 16(a2),d1
; move.l #%1111111111110111110011,d7 ; possible targets
; btst d1,d7
; beq.s HitObjLoop
move.w 12(a2),d1
move.l ZoneAdds,a3
move.l (a3,d1.w*4),a3
add.l LEVELDATA,a3
move.l a3,ToRoom
move.l ObjectPoints,a3
move.w (a3,d0.w*8),Targetx
move.w 4(a3,d0.w*8),Targetz
move.w 4(a2),Targety
move.b ObjInTop(a2),TargetTop
jsr CanItBeSeen
tst.b CanSee
beq HitObjLoop
move.w Targetx,d0
sub.w Viewerx,d0
move.w d0,d2
move.w Targetz,d1
sub.w Viewerz,d1
move.w d1,d3
muls d2,d2
muls d3,d3
move.w #1,d4
add.l d3,d2
beq .oksqr
move.w #31,d4
.findhigh
btst d4,d2
dbne d4,.findhigh
.foundhigh
asr.w #1,d4
clr.l d3
bset d4,d3
move.l d3,d4
move.w d4,d3
muls d3,d3 ; x*x
sub.l d2,d3 ; x*x-a
asr.l #1,d3 ; (x*x-a)/2
divs d4,d3 ; (x*x-a)/2x
sub.w d3,d4 ; second approx
bgt .stillnot0
move.w #1,d4
.stillnot0
move.w d4,d3
muls d1,d3
sub.l d2,d3
asr.l #1,d3
divs d4,d3
sub.w d3,d4 ; second approx
bgt .stillnot02
move.w #1,d4
.stillnot02
move.w d4,d3
muls d3,d3
sub.l d2,d3
asr.l #1,d3
divs d4,d3
sub.w d3,d4 ; second approx
bgt .stillnot03
move.w #1,d4
.stillnot03
.oksqr
move.w d4,d3
move.w d3,d7
cmp.w #40,d7
bge.s .okd
move.w #40,d7
.okd:
asr.w #3,d3
sub.w #4,d3
bge.s OkItsnotzero
moveq #0,d3
OkItsnotzero:
cmp.w #64,d3
bgt HitObjLoop
neg.w d3
add.w #64,d3
move.w d6,d5
muls d3,d5
asr.l #5,d5
cmp.w MaxDamage,d5
blt.s okdamage
move.w MaxDamage,d5
okdamage:
add.b d5,damagetaken(a2)
ext.l d0
ext.l d1
muls.l d6,d0
muls.l d6,d1
; asl.l #2,d0
; asl.l #2,d1
divs d7,d0
divs d7,d1
move.w d0,ImpactX(a2)
move.w d1,ImpactZ(a2)
move.l d6,d1
asl.l #4,d1
divs d7,d1
; move.w 4(a2),d0
; sub.w 4(a0),d0 ;dy
; bge.s .above
neg.w d1
;.above
cmp.w #-8,d1
bge.s .okbl
move.w #-8,d1
.okbl
move.w d1,ImpactY(a2)
bra HitObjLoop
CheckedEmAll:
; Now put in the flames!
move.l (a7)+,a0
move.w (a0),d0
move.l ObjectPoints,a2
move.w (a2,d0.w*8),d1
move.w 4(a2,d0.w*8),d2
move.w d1,middlex
move.w d2,middlez
move.w #9,d7
clr.b exitfirst
st.b wallbounce
move.w 12(a0),d0
move.l ZoneAdds,a3
move.l (a3,d0.w*4),a3
add.l LEVELDATA,a3
move.l a3,MiddleRoom
move.l PlayerShotData,a3
move.w 4(a0),d0
ext.l d0
asl.l #7,d0
move.l d0,oldy
moveq #2,d5
move.w #19,NUMTOCHECK
move.w #2,d6
radiusloop:
move.w #1,d7
DOFLAMES:
move.w NUMTOCHECK,d1
.findonefree
move.w 12(a3),d2
blt.s .foundonefree
adda.w #64,a3
dbra d1,.findonefree
rts
.foundonefree
move.b #2,16(a3)
move.w d1,NUMTOCHECK
add.w #1,doneflames
move.w middlex,d1
move.w middlez,d2
move.w d1,oldx
move.w d2,oldz
move.b ObjInTop(a0),StoodInTop
jsr GetRand
ext.w d0
muls d5,d0
asr.w #1,d0
bne.s .xnz
moveq #2,d0
.xnz:
add.w d0,d1
jsr GetRand
ext.w d0
muls d5,d0
asr.w #1,d0
bne.s .znz
moveq #2,d0
.znz:
add.w d0,d2
move.l oldy,d3
jsr GetRand
muls d5,d0
asr.l #3,d0
add.l d0,d3
move.l d3,newy
move.w d1,newx
move.w d2,newz
move.l MiddleRoom,objroom
movem.l d5/d6/a0/a1/a3/d7/a6,-(a7)
move.w #80,extlen
move.b #1,awayfromwall
jsr MoveObject
movem.l (a7)+,d5/d6/a0/a1/a3/d7/a6
move.l objroom,a2
move.w (a2),12(a3)
move.l newy,d0
move.l ToZoneFloor(a2),d1
move.l ToZoneRoof(a2),d2
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a2),d1
move.l ToUpperRoof(a2),d2
.okinbot:
cmp.l d0,d1
bgt.s .abovefloor
move.l d1,d0
.abovefloor:
cmp.l d0,d2
blt.s .belowroof
move.l d2,d0
.belowroof:
move.l d0,accypos(a3)
asr.l #7,d0
move.w d0,4(a3)
move.b #2,16(a3)
move.b #0,shotanim(a3)
; sub.b d5,shotanim(a3)
st shotstatus(a3)
move.b StoodInTop,ObjInTop(a3)
move.b BLOODYGREATBOMB,shotsize(a3)
st worry(a3)
move.w (a3),d0
move.l ObjectPoints,a2
move.w newx,(a2,d0.w*8)
move.w newz,4(a2,d0.w*8)
adda.w #64,a3
dbra d7,DOFLAMES
add.w #2,d5
dbra d6,radiusloop
rts
MiddleRoom: dc.l 0
middlex: dc.w 0
middlez: dc.w 0
doneflames: dc.w 0